/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package cn2;

import javax.swing.*;

/**
 *
 * @author Mathias
 */
public class SearchTask extends SwingWorker {
       Overlay myOverlay;
       String pattern;
       ViewPeer vp;       

       public SearchTask (Overlay o, ViewPeer vp, String pattern) {
           this.myOverlay = o;
           this.pattern = pattern;           
           this.vp = vp;           
       }

       @Override
       public String doInBackground() {

           java.util.ArrayList results = this.myOverlay.searchFileNeighbours(this.pattern);
           this.vp.search(results);
           return "";
       }

       @Override
       protected void done() {
           try {
               System.out.println("done");
           } catch (Exception ignore) {
           }
       }
}
